package com.pt.dto.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.time.LocalDateTime;

@Data
public class UserProfileResponse {
    private Long id;
    private String username;
    private String email;
    private Integer status;
    private Integer userClass;
    private Long uploaded;
    private Long downloaded;
    private Integer bonusPoints;
    private String passkey;
    private LocalDateTime createdTime;
    private LocalDateTime lastLoginTime;
    private String lastLoginIp;
    private String avatar;
    private String signature;
    private LocalDateTime assessmentDeadline;
    private Integer warningCount;
    
    // 计算分享率
    @JsonProperty("shareRatio")
    public Double getShareRatio() {
        if (downloaded == null || downloaded == 0) {
            return uploaded != null && uploaded > 0 ? Double.MAX_VALUE : 0.0;
        }
        return uploaded != null ? uploaded * 1.0 / downloaded : 0.0;
    }
} 